package com.sie.util;

public class StatusUtil {
    public static boolean onTime(String systemTime,String onTime) {
        String[] system = systemTime.split("T")[0].split("-");
        String[] onTimes = onTime.split("-");
        boolean flag = false;
        if (Integer.parseInt(system[0]) > Integer.parseInt(onTimes[0])) {
            flag = true;
        } else if (Integer.parseInt(system[0]) == Integer.parseInt(onTimes[0])) {
            if (Integer.parseInt(system[1]) > Integer.parseInt(onTimes[1])) {
                flag = true;
            } else if (Integer.parseInt(system[1]) == Integer.parseInt(onTimes[1])) {
                if (Integer.parseInt(system[2]) >= Integer.parseInt(onTimes[2])) {
                    flag = true;
                }
            }
        }
        return flag;
    }

    public static boolean offTime(String systemTime, String offTime) {
        String[] system = systemTime.split("T")[0].split("-");
        String[] offTimes = offTime.split("-");
        boolean flag = false;
        if (Integer.parseInt(system[0]) < Integer.parseInt(offTimes[0])) {
            flag = true;
        } else if (Integer.parseInt(system[0]) == Integer.parseInt(offTimes[0])) {
            if (Integer.parseInt(system[1]) < Integer.parseInt(offTimes[1])) {
                flag = true;
            } else if (Integer.parseInt(system[1]) == Integer.parseInt(offTimes[1])) {
                if (Integer.parseInt(system[2]) <= Integer.parseInt(offTimes[2])) {
                    flag = true;
                }
            }
        }
        return flag;
    }
}
